/*************************************************************************
 * File Name:    Single_Number.cc
 * Author:       zero91
 * Mail:         jianzhang9102@gmail.com
 * Created Time: Sun 27 Oct 2013 11:17:35 AM CST
 * 
 * Description:  
 |-----------------------------------------------------------------------
 | Problem: Single Number
 |
 | Given an array of integers, every element appears twice except for one.
 | Find that single one.
 |
 | Note:
 | Your algorithm should have a linear runtime complexity.
 | Could you implement it without using extra memory?
 |-----------------------------------------------------------------------
 |
 ************************************************************************/

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <iomanip>

using namespace std;

class Solution {
public:
    int singleNumber(int A[], int n) {
        int ans = 0;
        
        for (int i = 0; i < n; ++i) {
            ans ^= A[i];
        }
        return ans;
    }
};
